package com.mhz.cae.objects;

public class ItemType {

	public enum Type {
		TRAMPOLINE, SOCCER_BALL
	}

	private final Type mType;
	private final int mNumberTotal;
	private int mCurrentNumber;

	public ItemType(Type type, int number) {
		this.mType = type;
		this.mNumberTotal = number;
		this.mCurrentNumber = number;
	}

	public String getName() {
		switch (mType) {
		case TRAMPOLINE:
			return "Trampoline";
		case SOCCER_BALL:
			return "Ballon";
		}
		return null;
	}

	public int getCurrentNumber() {
		return mCurrentNumber;
	}

	public boolean isAvailable() {
		return (mCurrentNumber > 0);
	}

	public void disposeItem() {
		if (isAvailable()) {
			mCurrentNumber--;
		}
	}

	public void putItem() {
		if (mCurrentNumber + 1 <= mNumberTotal) {
			mCurrentNumber++;
		}
	}

	public Item createItem() {
		switch (mType) {
		case TRAMPOLINE:
			return Trampoline.createObject(200f, 400f, 200f, 10f, 0f);
		case SOCCER_BALL:
			return SoccerBall.createObject(200f, 400f);
		}
		return null;
	}

}
